package org.chupito.ui.controller;

import java.io.Serializable;
import java.util.List;
import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import org.chupito.data.StokeItem;
import org.chupito.service.StokeItemService;

@ManagedBean(name = "stokeItemController")
@SessionScoped
public class StokeItemController implements Serializable {

	private StokeItem selected;
	
	private List<StokeItem> stokeItems;

	@EJB(name = "StokeItemService")
	private StokeItemService service;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1928199179531048056L;

	public StokeItemController() {
		this.selected = new StokeItem();
	}
	
	@PostConstruct
	public void init() {
		
	}

	public void save() {
		service.save(selected);
		Logger.getLogger(StokeItemController.class.getName()).info("Save");
	}

	public void setSelected(StokeItem selected) {
		this.selected = selected;
	}

	public StokeItem getSelected() {
		return selected;
	}

	
	public List<StokeItem> getStokeItems() {
		return stokeItems;
	}
	
    public void setStokeItems(List<StokeItem> stokeItems) {
		this.stokeItems = stokeItems;
	}
	
}